package DataModel;

import java.util.ArrayList;

/**
 * This class represents a genomic locus. All genomic features are stored in a
 * list of buckets. A Locus can also contain the genomic sequence.
 * 
 * @author Stefan Lorenz<br>
 * <br>
 *         26.11.2012
 */
public class Locus {

    /**
     * The list of buckets which contain the {@link Feature}s
     */
    private ArrayList<FeatureBucket> bucketList = new ArrayList<FeatureBucket>();

    /**
     * The name of the locus
     */
    private String locusName;

    /**
     * The name of the organism where this locus is from
     */
    private String nameOfOrganism;

    /**
     * The genomic sequence of the locus
     */
    private StringBuffer sequence;

    /**
     * The size of the locus
     */
    private int locusSize;

    /**
     * The type of file defined by the file format
     */
    private String typeOfLocus;

    /**
     * The type of the sequence normally 'DNA'
     */
    private String typeOfSequence;

    /**
     * Contructor of an empty locus
     */
    public Locus() {
	this.typeOfLocus = "";
	this.locusName = "";
	this.nameOfOrganism = "";
	this.sequence = new StringBuffer();
	this.locusSize = 0;
	this.typeOfSequence = "";
    }

    /**
     * Sets the type of the locus coming from the file format
     * 
     * @param typeOfLocus
     *            the file format of the parsed data
     */
    public void setTypeOfLocus(String typeOfLocus) {
	this.typeOfLocus = typeOfLocus;
    }

    /**
     * Returns the file format of the parsed data
     * 
     * @return the file format
     */
    public String getTypeOfLocus() {
	return typeOfLocus;
    }

    /**
     * Sets the name of the locus
     * 
     * @param locusName
     *            the name of the locus
     */
    public void setLocusName(String locusName) {
	this.locusName = locusName;
    }

    /**
     * Returns the name of the locus
     * 
     * @return the name of the locus
     */
    public String getLocusName() {
	return locusName;
    }

    /**
     * Sets the name of the organism where the data is from
     * 
     * @param nameOfOrganism
     *            the name of the organism
     */
    public void setNameOfOrganism(String nameOfOrganism) {
	this.nameOfOrganism = nameOfOrganism;
    }

    /**
     * Returns the name of the organism of the locus
     * 
     * @return the name of the organism
     */
    public String getNameOfOrganism() {
	return nameOfOrganism;
    }

    /**
     * Sets a list {@link FeatureBucket}s containing {@link Feature}s for the
     * locus
     * 
     * @param list
     *            list of {@link FeatureBucket}s
     */
    public void setFeatureBucket(ArrayList<FeatureBucket> list) {
	this.bucketList = list;
    }

    /**
     * Returns a list of {@link FeatureBucket} which contain the {@link Feature}
     * s
     * 
     * @return a list of buckets
     */
    public ArrayList<FeatureBucket> getBucketList() {
	return bucketList;
    }

    /**
     * Sets the genomic sequence of the locus
     * 
     * @param sequence
     *            the sequence of the locus
     */
    public void setSequence(StringBuffer sequence) {
	this.sequence = sequence;
    }

    /**
     * Returns the sequence of the locus
     * 
     * @return the sequence of the locus
     */
    public StringBuffer getSequence() {
	return sequence;
    }

    /**
     * Sets the size of the locus in nucleotides
     * 
     * @param locusSize
     *            size of locus
     */
    public void setLocusSize(int locusSize) {
	this.locusSize = locusSize;
    }

    /**
     * Returns the size of the locus in nucleotides
     * 
     * @return the size of the locus
     */
    public int getLocusSize() {
	return locusSize;
    }

    /**
     * Sets the type of the sequence of the locus
     * 
     * @param typeOfSequence
     *            type of the sequence
     */
    public void setTypeOfSequence(String typeOfSequence) {
	this.typeOfSequence = typeOfSequence;
    }

    /**
     * Returns the type of the sequence
     * 
     * @return type of the sequence
     */
    public String getTypeOfSequence() {
	return typeOfSequence;
    }
}